package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysSaleRecordsMapper;
import com.ruoyi.system.domain.SysSaleRecords;
import com.ruoyi.system.service.ISysSaleRecordsService;

/**
 * 商品销售记录Service业务层处理
 *
 * @author silencezheng
 * @date 2023-01-09
 */
@Service
public class SysSaleRecordsServiceImpl implements ISysSaleRecordsService
{
    @Autowired
    private SysSaleRecordsMapper sysSaleRecordsMapper;

    /**
     * 查询商品销售记录
     *
     * @param id 商品销售记录主键
     * @return 商品销售记录
     */
    @Override
    public SysSaleRecords selectSysSaleRecordsById(Long id)
    {
        return sysSaleRecordsMapper.selectSysSaleRecordsById(id);
    }

    /**
     * 查询商品销售记录列表
     *
     * @param sysSaleRecords 商品销售记录
     * @return 商品销售记录
     */
    @Override
    public List<SysSaleRecords> selectSysSaleRecordsList(SysSaleRecords sysSaleRecords)
    {
        return sysSaleRecordsMapper.selectSysSaleRecordsList(sysSaleRecords);
    }

    /**
     * 新增商品销售记录
     *
     * @param sysSaleRecords 商品销售记录
     * @return 结果
     */
    @Override
    public int insertSysSaleRecords(SysSaleRecords sysSaleRecords)
    {
        sysSaleRecords.setCreateTime(DateUtils.getNowDate());
        sysSaleRecords.setCreateBy(SecurityUtils.getUsername());
        return sysSaleRecordsMapper.insertSysSaleRecords(sysSaleRecords);
    }

    /**
     * 修改商品销售记录
     *
     * @param sysSaleRecords 商品销售记录
     * @return 结果
     */
    @Override
    public int updateSysSaleRecords(SysSaleRecords sysSaleRecords)
    {
        sysSaleRecords.setUpdateTime(DateUtils.getNowDate());
        return sysSaleRecordsMapper.updateSysSaleRecords(sysSaleRecords);
    }

    /**
     * 批量删除商品销售记录
     *
     * @param ids 需要删除的商品销售记录主键
     * @return 结果
     */
    @Override
    public int deleteSysSaleRecordsByIds(Long[] ids)
    {
        return sysSaleRecordsMapper.deleteSysSaleRecordsByIds(ids);
    }

    /**
     * 删除商品销售记录信息
     *
     * @param id 商品销售记录主键
     * @return 结果
     */
    @Override
    public int deleteSysSaleRecordsById(Long id)
    {
        return sysSaleRecordsMapper.deleteSysSaleRecordsById(id);
    }
}
